<template>
	<view class="contont">
		<nav-bar :title="title" :iconLeft="true" />
		<view class="content-bgc">
			<custom-list-de :record="detail_record" :columns="columns">
				<template #picture="{ text, record }">
					<image v-if="record.picture" :src="record.picture" class="preview-img"
						@click="previewImage(record.picture)" />
				</template>
				<template #marriage="{ text, record }">
					{{ text == 1 ? '未婚' : (text == 2 ? '已婚' : '离异') }}
				</template>
			</custom-list-de>
		</view>
	</view>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import acUserApi from '../../../api/account/ac_user'

const detail_record = ref({})
const title = '员工管理详情';
onLoad(option => {
	get_detail(option.id);
})

const columns = [
	{ title: "照片", dataIndex: 'picture', scopedSlots: 'picture' },
	{ title: "员工类型", dataIndex: 'classify_display' },
	{ title: "工号", dataIndex: 'code' },
	{ title: "姓名", dataIndex: 'full_name' },
	{ title: "手机号", dataIndex: 'mobile' },
	{ title: "职务", dataIndex: 'role_names' },
	{ title: "部门", dataIndex: 'group_name' },
	{ title: "民族", dataIndex: 'nation' },
	{ title: "性别", dataIndex: 'sex_display' },
	{ title: "身份证号码", dataIndex: 'idcard' },
	{ title: "出生日期", dataIndex: 'birthday' },
	{ title: "地址", dataIndex: 'address' },
	{ title: "婚姻状况", dataIndex: 'marriage', scopedSlots: 'marriage' },
	{ title: "政治面貌", dataIndex: 'politics' },
	{ title: "紧急联系人", dataIndex: 'urgency_full_name' },
	{ title: "紧急联系人电话", dataIndex: 'urgency_mobile' },
	{ title: "基本工资", dataIndex: 'salary' },
	{ title: "学历", dataIndex: 'degree' },
	{ title: "银行名称", dataIndex: 'bank_name' },
	{ title: "开户网点", dataIndex: 'bank_branch' },
	{ title: "银行卡号", dataIndex: 'bank_code' },
	{ title: "入职时间", dataIndex: 'in_date' },
	{ title: "合同开始时间", dataIndex: 'contract_start_date' },
	{ title: "合同结束时间", dataIndex: 'contract_end_date' },
	{ title: "备注", dataIndex: 'desc', note: true, },
]
function get_detail(id) {
	acUserApi.staff_detail(id).then(data => {
		detail_record.value = data
	})
}
const previewImage = (img) => {
	// uniapp 原生预览图片方法
	uni.previewImage({
		current: img.url || img,  // 当前显示图片
		urls: [img.url || img]    // 图片列表
	})
}

</script>

<style lang="scss"></style>